// 如果没有通过拦截器配置域名的话，可以在这里写上完整的URL(加上域名部分)
let hotSearchUrl = 'http://www.zb1237.com/';
// let hotSearchUrl = '/apis/';

// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作，更多内容详见uView对拦截器的介绍部分：
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AFmt4.ascetic.top%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
const install = (Vue, vm) => {
	// 首页推荐壁纸
	let indexHot = (params = {}) => vm.$u.get(hotSearchUrl+'bff/query/category/list/', params);
	// 市场动态
	let service = (params = {}) => vm.$u.get(hotSearchUrl+'service', params);
	//验证码
	let captcha = (params = {}) => vm.$u.get(hotSearchUrl+'captcha');
	// 注册
	let servicepost = (params = {}) => vm.$u.post(hotSearchUrl+'api/login/do_register', params);
	// 市场动态
	let index = (params = {}) => vm.$u.get(hotSearchUrl+'api/index/index', params);
	// 市场动态
	let login = (params = {}) => vm.$u.post(hotSearchUrl+'api/login/post', params);
	//走势
	let getKine = (params = {}) => vm.$u.post(hotSearchUrl+'api/trend/kline', params);
	// 银行卡列表
	let banklist = (params = {}) => vm.$u.get(hotSearchUrl+'api/personal/banklist/token/' + uni.getStorageSync('Authorized'), params);
	// 添加银行卡
	let add_bank = (params = {}) => vm.$u.post(hotSearchUrl+'api/personal/add_bank/token/' + uni.getStorageSync('Authorized'), params);
	// 删除银行卡
	let del_bank = (params = {}) => vm.$u.post(hotSearchUrl+'api/personal/del_bank/token/' + uni.getStorageSync('Authorized'), params);
	// 赎回
	let withdraw = (params = {}) => vm.$u.get(hotSearchUrl+'api/personal/withdraw/token/' + uni.getStorageSync('Authorized'), params);
	// 余额提现
	let do_withdraw = (params = {}) => vm.$u.get(hotSearchUrl+'api/personal/do_withdraw/token/' + uni.getStorageSync('Authorized'), params);
	//个人信息
	let user = (params = {}) => vm.$u.get(hotSearchUrl+'/api/personal/index/token/' + uni.getStorageSync('Authorized'), params);
	//修改密码
	let editpassword = (params = {}) => vm.$u.post(hotSearchUrl+'api/personal/editpassword/token/' + uni.getStorageSync('Authorized'), params);
	// 资金密码
	let securitypassword = (params = {}) => vm.$u.post(hotSearchUrl+'api/personal/securitypassword/token/' + uni.getStorageSync('Authorized'), params);
	// 赎回记录
	let withdrawlsrecord = (params = {}) => vm.$u.post(hotSearchUrl+'api/personal/withdrawlsrecord/token/' + uni.getStorageSync('Authorized'), params);
	// 客服
	let customer = (params = {}) => vm.$u.get(hotSearchUrl+'/api/customer/index');
	// DECP
	let getDECPList = (params = {}) => vm.$u.get(hotSearchUrl+'/api/rooms/china/hall/1/token/' +  uni.getStorageSync('Authorized'));
	//DECP 投资记录
	let getDECPListSubmit = (params = {}) => vm.$u.post(hotSearchUrl+'/api/rooms/betting/token/' +  uni.getStorageSync('Authorized'), params);
	//交易记录
	let getbettingRecord = (params = {}) => vm.$u.post(hotSearchUrl+'/api/personal/betting_record/token/' +  uni.getStorageSync('Authorized'), params);
	//入金
	let getrechargerecord = (params = {}) => vm.$u.post(hotSearchUrl+'api/personal/rechargerecord/token/' +  uni.getStorageSync('Authorized'), params);
	
	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	vm.$u.api = {
		indexHot,
		service,
		servicepost,
		index,
		login,
		getKine,
		user,
		customer,
		editpassword,
		securitypassword,
		getDECPList,
		getDECPListSubmit,
		banklist,
		add_bank,
		del_bank,
		withdraw,
		do_withdraw,
		withdrawlsrecord,
		getbettingRecord,
		getrechargerecord,
		captcha
		
	};
}

export default {
	install
}